package summerRouter

import (
	restfulspec "github.com/emicklei/go-restful-openapi/v2"
	"github.com/emicklei/go-restful/v3"
	"webGoDemo/model"
	summerController2 "webGoDemo/summer/summerController"
)

func AddUserRouter(container *restful.Container) {
	ws := new(restful.WebService)
	ws.
		Path("/user").
		Consumes(restful.MIME_XML, restful.MIME_JSON).
		Produces(restful.MIME_JSON, restful.MIME_XML) // you can specify this presenter route as well
	tags := []string{"users"}
	ws.Route(ws.GET("/").To(summerController2.FindAllUsers).
		// docs
		Doc("get all users").
		Metadata(restfulspec.KeyOpenAPITags, tags).
		Writes([]model.User{}).
		Returns(200, "OK", []model.User{}))
	container.Add(ws)
}
